<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>t_sync</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4>NAME</h4><blockquote>
t_sync - synchronise transport library
</blockquote><h4>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="xti.h.html">xti.h</a>&gt;

int t_sync(
    int fd)
</code>
</pre>
</blockquote><h4>DESCRIPTION</h4><blockquote>
<pre>
<P><table  bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Parameters</b>
<th align=center><b>Before call</b>
<th align=center><b>After call</b>
<tr valign=top><td align=left>fd
<td align=center>x
<td align=center>/
</table>
</pre>
<p>
For the transport endpoint specified by
<I>fd</I>,
<i>t_sync()</i>
synchronises the data structures managed by the transport library
with information from the underlying transport provider.
In doing so, it can convert an uninitialised file descriptor
(obtained via
<i><a href="../xsh/open.html">open()</a></i>,
<i><a href="../xsh/dup.html">dup()</a></i>
or as a result of a
<i><a href="../xsh/fork.html">fork()</a></i>
and
<i><a href="../xsh/exec.html">exec()</a></i>)
to an initialised transport endpoint, assuming that the
file descriptor referenced
a transport  endpoint, by updating and allocating the necessary library
data structures.
This function also allows two cooperating processes to synchronise their
interaction with a transport provider.
<p>
For example, if a process forks
a new process and issues an
<i><a href="../xsh/exec.html">exec()</a></i>,
the new process must issue a
<i>t_sync()</i>
to build the private library data structure associated with a
transport endpoint and to synchronise the data structure
with the relevant provider information.
<p>
It is important to remember that the transport provider treats
all users of a transport endpoint as a single user.
If multiple processes are using the same endpoint, they should
coordinate their activities so as not to violate the state of the
transport endpoint.  The function
<i>t_sync()</i>
returns the current state of the transport endpoint to the user, thereby
enabling the user to verify the state before taking further
action.
This coordination is only valid among cooperating processes;
it is possible that a process or an incoming event
could change the endpoint's state
<I>after</I>
a
<i>t_sync()</i>
is issued.
<p>
If the transport endpoint is undergoing a state transition when
<i>t_sync()</i>
is called, the function will fail.
</blockquote><h4>VALID STATES</h4><blockquote>
ALL - apart from T_UNINIT
</blockquote><h4>ERRORS</h4><blockquote>
On failure,
<I>t_errno</I>
is set to one of the following:
<dl compact>

<dt>[TBADF]<dd>The specified file descriptor
does not refer to a transport endpoint.
This error may be returned when the
<I>fd</I>
has been previously closed
or an erroneous number may have been passed to the call.

<dt>[TPROTO]<dd>This error indicates that a communication problem has been detected between
XTI and the transport provider for which there is no other suitable XTI
error
<I>(t_errno)</I>.

<dt>[TSTATECHNG]<dd>The transport endpoint is undergoing a state change.

<dt>[TSYSERR]<dd>A system error has occurred during execution of this function.

</dl>
</blockquote><h4>RETURN VALUE</h4><blockquote>
On successful completion, the state of the transport endpoint is
returned.  Otherwise, a value of -1 is returned and
<I>t_errno</I>
is set to indicate an error. The state returned is one of the following:
<dl compact>

<dt>T_UNBND<dd>Unbound.

<dt>T_IDLE<dd>Idle.

<dt>T_OUTCON<dd>Outgoing connection pending.

<dt>T_INCON<dd>Incoming connection pending.

<dt>T_DATAXFER<dd>Data transfer.

<dt>T_OUTREL<dd>Outgoing orderly release (waiting for an orderly release indication).

<dt>T_INREL<dd>Incoming orderly release (waiting for an orderly release request).

</dl>
</blockquote><h4>SEE ALSO</h4><blockquote>
<i><a href="../xsh/dup.html">dup()</a></i>,
<i><a href="../xsh/exec.html">exec()</a></i>,
<i><a href="../xsh/fork.html">fork()</a></i>,
<i><a href="../xsh/open.html">open()</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
